/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-16 15:33:19
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-16 16:21:54
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/controller/light_controller.dart';
import 'package:get/get.dart';
import './light_item.dart';

class LightList extends StatelessWidget {
  const LightList({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) => GetBuilder<LightController>(
        builder: (_controller) => GridView.builder(
          physics: NeverScrollableScrollPhysics(),
          padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 2,
            crossAxisSpacing: 20,
            mainAxisSpacing: 15,
            childAspectRatio: 1.2,
          ),
          itemCount: _controller.lightList.length,
          itemBuilder: (context, index) =>
              LightItem(light: _controller.lightList[index]),
        ),
      );
}
